package com.codegzy.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.codegzy.entity.User;
import com.codegzy.mapper.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional
public class UserServiceImpl implements UserService {

    @Autowired
    private UserMapper userMapper;

    @Override
    public User login(User user) {
        QueryWrapper<User> wrapper = new QueryWrapper<>();
        wrapper.eq("name", user.getName());
        wrapper.eq("age", user.getAge());
        return userMapper.selectOne(wrapper);
    }
}
